package com.module.base.base

import androidx.annotation.Keep
import com.module.base.bean.IBaseType
import com.chad.library.adapter.base.entity.MultiItemEntity
import com.kingja.loadsir.callback.Callback
import com.kingja.loadsir.core.Transport
import kotlinx.coroutines.flow.MutableSharedFlow

@Keep
class ErrorViewBean : MultiItemEntity {

    companion object {
        val TYPE_LOADDING = 2
        val TYPE_EMPTY = 0
        val TYPE_ERROR = 1
        val TYPE_NULL = 2
    }

    private var isFull = false
    private var type = 0

    //点击刷新监听的bus
    private var refreshFlow: MutableSharedFlow<Any>? = null

    /**
     * 缺省图样式
     */
    private var mapTransport: Map<Class<out Callback>, Transport>? = null

    constructor(type: Int, refreshFlow: MutableSharedFlow<Any>) {
        this.type = type
        this.refreshFlow = refreshFlow;
    }

    constructor(type: Int, isFull: Boolean, refreshFlow: MutableSharedFlow<Any>) {
        this.type = type
        this.isFull = isFull
        this.refreshFlow = refreshFlow;
    }


    override fun getItemType(): Int {
        return IBaseType.IVHType.TYPE_EMPTY;
    }

    fun isFull(): Boolean {
        return isFull
    }

    fun setFull(full: Boolean) {
        isFull = full
    }

    fun getMapTransport(): Map<Class<out Callback>, Transport>? {
        return mapTransport
    }

    fun setMapTransport(mmapTransport: Map<Class<out Callback>, Transport>) {
        this.mapTransport = mapTransport
    }

    fun getFlowBus(): MutableSharedFlow<Any>? {
        return refreshFlow
    }

    fun setRxRefreshBus(sharedFlow: MutableSharedFlow<Any>) {
        refreshFlow = sharedFlow
    }

    fun getType(): Int {
        return type
    }

    fun setType(type: Int) {
        this.type = type
    }
}